<%@ include file="/WEB-INF/jsp/common/include.jsp" %>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="app" uri="AppTags" %>
<div class="box-container" id="flatAd<c:out value='${flatAd.id}'/>" style="background: white; border-radius: 10px; margin-bottom: 22px" itemscope itemtype="http://schema.org/RentAction">
  <c:choose>
    <c:when  test="${flatAd.external}">
      <c:set var="flatUrl" value="${flatAd.externalUrl}?partner=6"/>
    </c:when>
    <c:otherwise>
      <c:set var="flatUrl" value="/ad/details/${flatAd.id}/view.do"/>
    </c:otherwise>
  </c:choose>
  <h2><a class="psevdo" href="${flatUrl}" itemprop="location"><spring:message code="label.city.${flatAd.city}" />, <c:out value="${flatAd.street}"
      /><c:if test="${not empty flatAd.building}">, <c:out value="${flatAd.building}"/></c:if></a></h2>
  <p class="note"><em>подано: <strong itemprop="startTime"><fmt:formatDate value="${flatAd.lastPublishingDate}" pattern="dd.MM.yyyy" timeZone="Europe/Minsk"/></strong>, количество комнат: <strong><c:out value="${flatAd.room}"/></strong></em></p>
  <p itemprop="description">
    Сдам квартиру по адресу <spring:message code="label.city.${flatAd.city}" />, <c:out value="${flatAd.street}"
      /><c:if test="${not empty flatAd.building}">, <c:out value="${flatAd.building}"/></c:if> <c:choose><c:when
      test="${flatAd.pricePerDay}">на сутки</c:when><c:otherwise>на длительный срок</c:otherwise></c:choose><c:choose><c:when
      test="${flatAd.agent}"></c:when><c:otherwise> без посредников</c:otherwise></c:choose>.
    <c:if test="${not empty flatAd.description}"><c:out value="${flatAd.description}"/></c:if>
  </p>
  <tiles:insertAttribute name="images" />
  <p>
    Контактная информация:
    <c:choose>
      <c:when  test="${flatAd.external}">
        <em class="owner"><a class="psevdo" href="${flatAd.externalUrl}?partner=6" title="Объявления проверенные вручную">caйт-партнёр (bling.by)</a></em>
      </c:when>
      <c:when  test="${flatAd.agent}">
        <em class="agent"><img class="icon" alt="агенство" src="<app:slaveServerUrl />/image/agent.png" />агентство</em>, тел.: <a class="psevdo" href="tel:${flatAd.phone}"><c:out value="${flatAd.phone}"/></a>
      </c:when>
      <c:otherwise>
        <em class="owner"><img class="icon" alt="не агентство" src="<app:slaveServerUrl />/image/owner.png" />без посредников</em>, тел.: <a class="psevdo" href="tel:${flatAd.phone}"><c:out value="${flatAd.phone}"/></a>
      </c:otherwise>
    </c:choose>
  </p>
  <p class="price" itemprop="price">
    <c:out value="${flatAd.price}"/>$
  </p>
  <div class="rating">
    <jsp:include page="/WEB-INF/jsp/ad/search/rating.jsp">
      <jsp:param name="flatAdId" value="${flatAd.id}"/>
      <jsp:param name="rating" value="${normalizedRating}"/>
    </jsp:include>
  </div>
  <div id="reviewContainer<c:out value='${flatAd.id}'/>">
    <jsp:include page="/WEB-INF/jsp/ad/search/review/flatReview.jsp"/>
  </div>
</div>